package unit4.part13;

import java.util.Random;

public class AdultCount {
    public static int[] getAges() {
        Random random = new Random();
        int[] ages = new int[10];
        for (int i = 0; i < ages.length; i++) {
            ages[i] = random.nextInt(61);
        }
        return ages;
    }

    public static int getAdultCount(int[] ages) {
        int num = 0;
        for (int age : ages) {
            if (age >= 18) {
                num++;
            }
        }
        return num;
    }

    public static void main(String[] args) {
        System.out.println(getAges().length);
        System.out.println(getAdultCount(new int[]{24, 11, 14, 5, 16, 1, 38, 7, 8, 60, }));
    }
}
